#include "steering.h"
#include "os.h"
#include "bsp_adc.h"
#include "components.h"
#include "stm32f1xx_hal_gpio.h"
void Steering_task(void * arg) {
	PWM_SetFrequency(&pwm1[1],50);
	
while(1){
	if(control.triSwitch[0]==2){
//normally 
		if(control.channel[1]==0){
		PWM_SetDutyRatio(&pwm1[1],0.075);
		}
		if(control.channel[1]<0){
		PWM_SetDutyRatio(&pwm1[1],0.075-0.05*control.channel[1]);
		}
		if(control.channel[1]>0){
		PWM_SetDutyRatio(&pwm1[1],0.075-0.04*control.channel[1]);
		}
//specific
		if(control.channel[0]>0.5){
		PWM_SetDutyRatio(&pwm1[1],0.118);   //low one
		}
		
		if(control.channel[0]<-0.5){
		PWM_SetDutyRatio(&pwm1[1],0.075);   //high one
		}
		
		if(control.channel[2]>0.5){
		PWM_SetDutyRatio(&pwm1[1],0.080);    //middle one
		}
		
		if(control.channel[2]<-0.5){
		PWM_SetDutyRatio(&pwm1[1],0.055);     //exchange one
		}
		
		delay(5);
	  }
}	
}